<!-- 客服兼容 -->
<template>
	<view class="chat-template-box" v-if="showChat">
		<Chat v-if="isRhinoChat"></Chat>
		<Wm v-if="!isRhinoChat" :options="kefuOptions"></Wm>
	</view>
</template>

<script>
	import {
		mapMutations,
		mapActions,
		mapState,
		mapGetters
	} from "vuex";
	import Chat from "./rhino/index.vue";
	import Wm from "./wm/index.vue";
  
	export default {
		components: {
			Chat,
			Wm
		},
		data() {
			return {
				isRhinoChat: false,
				kefuOptions: null,
				showChat: false
			};
		},
		computed: {
			...mapGetters(["initAddons", "initChat"])
		},
		onLoad(options) {
			this.kefuOptions = options;
			//判断客服;
			if (this.initChat && this.initChat.type === "rhino") {
				this.isRhinoChat = true;
			} else {
				if (this.initAddons.length && this.initAddons.includes("kefu")) {
					this.isRhinoChat = false;
				}
			}
			this.showChat = true;
		},
		methods: {}
	};
</script>

<style lang="scss">
	.chat-template-box {
		height: 100%;
		width: 100%;
		overflow: hidden;
	}
</style>
